package com.hu.video.controller;

import com.hu.video.entity.TUser;
import com.hu.video.service.IFansService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import org.springframework.web.bind.annotation.RequestParam;

@RestController
@RequestMapping("/api/fans")
public class FansController {
    @Autowired
    private IFansService fansService;

    // 获取粉丝ID列表
    @GetMapping("/idlist/{userId}")
    public List<Long> getFansIdList(@PathVariable Long userId) {
        return fansService.getFansIdList(userId);
    }

    // 获取粉丝详细信息列表，支持分页
    @GetMapping("/userlist/{userId}")
    public List<TUser> getFansUserList(@PathVariable Long userId,
                                       @RequestParam(value = "page", required = false, defaultValue = "1") int page,
                                       @RequestParam(value = "size", required = false, defaultValue = "20") int size) {
        // 这里简单返回全部粉丝，如需分页可在Service/Mapper层实现limit/offset
        return fansService.getFansUserList(userId);
    }
} 